Solved

How to set security based on User in Event Receiver in wss 3.0?

Posted on 2009-04-03
11
393 Views
Last Modified: 2012-05-06
HIi All,
  i am using wss 3.0 and i made a event Receiver of Sharepoint list. i am updating ListA from ListB..I need to update ListA based on user who loged in.. i have one column OWner in List B. so i want to match owner with user loged in.if condition match then i have to update otherwise i have to take information from ListA to ListB.
Let me know if you have any question
 
0
Comment
Question by:guessdip
  • 6
  • 5
11 Comments
 
LVL 16

Expert Comment

by:raybies
ID: 24073571
if(SPWeb.CurrentUser.LoginName == SPListItem["USERFIELD"])
{
 DO_Stuff
}
0
 

Author Comment

by:guessdip
ID: 24079854
Thanks Dude,
  i am trying to do this things in event.But one more problem i got. Exactly i am updating ListB And ListC from ListA. So i made only one event for that. in code i have mentioned Both List B and C, and in sharepoint i made two different view for ListB and And ListC. and Both view are connected. So when i use Firstview to update ListB then it works but after that when i use Secone view to update ListC then every time i get error "" Another user updating and i get two option retrive and Discard?

I dont why this is hapning,simultensanly i get this error. I have to close event or what i have to do? i am sending you code. let me know if i made any mistake.

Thank you.

using System;
using System.Collections.Generic;
using System.Text;
using System.Configuration;
using Microsoft.SharePoint;
using System.Data;
using System.Windows.Forms;
 
 
namespace ProjectsListEvent
{
    public class ProjectsListEvent : SPItemEventReceiver
    {
  string project = null;
        string[] ColumnList = new string[3];
        string[] AppList = new string[58];
        string[] ESLSList = new string[13];
        string[] ESLSMasterList = new string[13];
 
        string[] ESPSList = new string[9];
        string[] ESPSMasterList = new string[9];
 
        string[] ESPSListForMaster = new string[9];
        string[] ESPSMasterListForMaster = new string[9];
 
        SPSite otherspSite = null;
        SPWeb otherweb = null;
 
        SPSite spSite = null;
        SPWeb web = null;
        string DestinationList = "";
        string ESLSDestinationList = "";
        string DestinationListForLServer = "";
        string DestinationSite = "";
        string ListName = "";
       
        string DBUpdate = "";
        string ESLS_ServerName = "";
        string PSerialNumber = "";
        string AppAcronym = "";
 
 
       
 
        public override void ItemAdded(SPItemEventProperties properties)
        {
            //base.ItemAdded(properties);
         //////   string[] newValue = new string[3];
 
         //////   ColumnList[0] = "Phase";
         //////   ColumnList[1] = "State";
         //////   ColumnList[2] = "FinalDispState";
 
         //////   DestinationList = System.Configuration.ConfigurationManager.AppSettings["DestListName"].ToString();
         //////   ESLSDestinationList = System.Configuration.ConfigurationManager.AppSettings["ESLSDestListName"].ToString();
         //////   DestinationListForLServer = System.Configuration.ConfigurationManager.AppSettings["DestListNameForLServer"].ToString();
 
         //////   SPListItem anItem = properties.ListItem;
         //////   spSite = new SPSite(properties.WebUrl.ToString());
         //////   web = spSite.OpenWeb();
         //////   project = properties.ListItem["Title"].ToString();
         //////   ListName = properties.ListTitle.ToString();
         ////////   oldColumn1 = properties.ListItem["Title"].ToString();
         //////   //   newColumn1 = properties.AfterProperties["Title"].ToString();
         //////   newValue[0] = properties.AfterProperties[ColumnList[0]].ToString();
         //////   newValue[1] = properties.AfterProperties[ColumnList[1]].ToString();
         //////   newValue[2] = properties.AfterProperties[ColumnList[2]].ToString();
 
         //////   DataTable siteListTBL = GetDestinationSiteList();
 
         //////   if (siteListTBL.Rows.Count > 0)
         //////   {
         //////       foreach (DataRow dr in siteListTBL.Rows)
         //////       {
         //////           DestinationSite = dr["Title"].ToString();
 
         //////           otherspSite = new SPSite(DestinationSite);
         //////           otherweb = otherspSite.OpenWeb();
 
         //////           //First Column Update
         //////           UpdateListItemToAnotherList(anItem, newValue, ColumnList);
         //////       }
            
         //////   }
        }
 
       
 
        public override void ItemUpdated(SPItemEventProperties properties)
        {
            //base.ItemUpdated(properties);
            string oldColumn1 = "";
            string oldColumn2 = "";
            string oldColumn3 = "";
            string newColumn1 = "";
            string newColumn2 = "";
            string newColumn3 = "";
 
            string[] newValue = new string[3];
            string[] AppValue = new string[58];
            string[] ESValue = new string[13];
 
            string[] ESPValue = new string[9];
            
 
            ColumnList[0] = "Phase";
            ColumnList[1] = "State";
            ColumnList[2] = "FinalDispState";
 
            AppList[0] = "Phase";
            AppList[1] = "State";
            AppList[2] = "FinalDispState";
            AppList[3] = "I_AdditionalInformation";
            AppList[4] = "I_AppAvailSLA";
            AppList[5] = "I_AppReqDataTransfer_x003F_";
            AppList[6] = "I_AppRetirementDate";
            AppList[7] = "I_AppServerPool";
            AppList[8] = "I_BIORep";
            AppList[9] = "I_DBSizeGB";
            AppList[10] = "I_DBType";
            AppList[11] = "I_DependencyonOtherApps_x002d_Se";
            AppList[12] = "I_DownstreamInterfaces";
            AppList[13] = "I_GroupName";
            AppList[14] = "I_ITApplicationContact_x0023_";
            AppList[15] = "I_ITApplicationManager";
            AppList[16] = "I_ITApplicationManager_x0023_";
            AppList[17] = "I_ITPrimaryAppContact";
            AppList[18] = "I_KPHCCoSapplication_x003F_";
            AppList[19] = "I_MaintenanceWindow";
            AppList[20] = "I_MaxAllowableOutage";
            AppList[21] = "I_Middleware_x003F_";
            AppList[22] = "I_OutageOK_x003F_BeyondMaintWind";
            AppList[23] = "I_SANGB";
            AppList[24] = "I_SanImpact";
            AppList[25] = "I_ServerCount";
            AppList[26] = "I_SrManager";
            AppList[27] = "I_SupportedByAIMS";
            AppList[28] = "I_UpstreamInterfaces";
            AppList[29] = "I_Web_x002d_Based_x003F_";
 
            AppList[30] = "ES_AdditionalInformation";
            AppList[31] = "ES_AppAvailSLA";
            AppList[32] = "ES_AppReqDataTransfer_x003F_";
            AppList[33] = "ES_AppRetirementDate";
            AppList[34] = "ES_AppServerPool";
            AppList[35] = "ES_BIORep";
            AppList[36] = "ES_DBSizeGB";
            AppList[37] = "ES_DBType";
            AppList[38] = "ES_DependencyonOtherApps_x002d_S";
            AppList[39] = "ES_DownStreamInterfaces";
            AppList[40] = "ES_GroupName";
            AppList[41] = "ES_ITApplicationContact_x0023_";
            AppList[42] = "ES_ITApplicationManager";
            AppList[43] = "ES_ITApplicationManager_x0023_";
            AppList[44] = "ES_ITPrimaryAppContact";
            AppList[45] = "ES_KPHCCoSapplication_x003F_";
            AppList[46] = "ES_MaintenanceWind";
            AppList[47] = "ES_MaxAllowableOutage";
            AppList[48] = "ES_Middleware_x003F_";
            AppList[49] = "ES_OutageOK_x003F_BeyondMaintWin";
            AppList[50] = "ES_SANGB";
            AppList[51] = "ES_SANImpact";
            AppList[52] = "ES_ServerCount";
            AppList[53] = "ES_SrManager";
            AppList[54] = "ES_SupportedByAIMS";
            AppList[55] = "ES_UpstreamInterfaces";
            AppList[56] = "ES_Web_x002d_Based_x003F_";
            
           
 
            ESLSList[0] = "ESLS_ServerName";
            ESLSList[1] = "ESLS_FQDN";
            ESLSList[2] = "ESLS_IPAddress";
            ESLSList[3] = "ESLS_Environment";
            ESLSList[4] = "ESLS_ESerialNumber";
            ESLSList[5] = "ESLS_ExtStorage";
            ESLSList[6] = "ESLS_IntStorage";
            ESLSList[7] = "ESLS_Notes";
            ESLSList[8] = "ESLS_OSName";
            ESLSList[9] = "ESLS_OSVersion";
            ESLSList[10] = "ESLS_RAM";
            ESLSList[11] = "ESLS_CPUs";
            ESLSList[12] = "ESLS_PSerialNumber";
 
 
            ESLSMasterList[0] = "Title";
            ESLSMasterList[1] = "FQDN";
            ESLSMasterList[2] = "IPAddress";
            ESLSMasterList[3] = "Environment";
            ESLSMasterList[4] = "ESerialNumber";
            ESLSMasterList[5] = "ExtStorage";
            ESLSMasterList[6] = "IntStorage";
            ESLSMasterList[7] = "Notes";
            ESLSMasterList[8] = "OSName";
            ESLSMasterList[9] = "OSVersion";
            ESLSMasterList[10] = "RAM";
            ESLSMasterList[11] = "CPUs";
            ESLSMasterList[12] = "PSerialNumber";
 
            ESPSList[0] = "ESPS_TotalCPUs";
            ESPSList[1] = "ESPS_TotalRAM";
            ESPSList[2] = "ESPS_TotalIntStorage";
            ESPSList[3] = "ESPS_LocFloor";
            ESPSList[4] = "ESPS_LocRoom";
            ESPSList[5] = "ESPS_LocGrid";
            ESPSList[6] = "ESPS_Facility";
            ESPSList[7] = "ESPS_Brand";
            ESPSList[8] = "ESPS_Model";
          
 
            ESPSMasterList[0] = "TotalCPUs";
            ESPSMasterList[1] = "TotalRAM";
            ESPSMasterList[2] = "TotalIntStorage";
            ESPSMasterList[3] = "LocFloor";
            ESPSMasterList[4] = "LocRoom";
            ESPSMasterList[5] = "LocGrid";
            ESPSMasterList[6] = "Facility";
            ESPSMasterList[7] = "Brand";
            ESPSMasterList[8] = "Model";
 
            ESPSMasterListForMaster[0] = "ESPS_TotalCPUs";
            ESPSMasterListForMaster[1] = "ESPS_TotalRAM";
            ESPSMasterListForMaster[2] = "ESPS_TotalIntStorage";
            ESPSMasterListForMaster[3] = "ESPS_LocFloor";
            ESPSMasterListForMaster[4] = "ESPS_LocRoom";
            ESPSMasterListForMaster[5] = "ESPS_LocGrid";
            ESPSMasterListForMaster[6] = "ESPS_Facility";
            ESPSMasterListForMaster[7] = "ESPS_Brand";
            ESPSMasterListForMaster[8] = "ESPS_Model";
 
 
            ESPSListForMaster[0] = "TotalCPUs";
            ESPSListForMaster[1] = "TotalRAM";
            ESPSListForMaster[2] = "TotalIntStorage";
            ESPSListForMaster[3] = "LocFloor";
            ESPSListForMaster[4] = "LocRoom";
            ESPSListForMaster[5] = "LocGrid";
            ESPSListForMaster[6] = "Facility";
            ESPSListForMaster[7] = "Brand";
            ESPSListForMaster[8] = "Model";
 
           
 
            DestinationList = System.Configuration.ConfigurationManager.AppSettings["DestListName"].ToString();
            DestinationListForLServer = System.Configuration.ConfigurationManager.AppSettings["DestListNameForLServer"].ToString();
            ESLSDestinationList = System.Configuration.ConfigurationManager.AppSettings["ESLSDestListName"].ToString();
            SPSecurity.RunWithElevatedPrivileges(delegate()
             {
 
                 SPListItem anItem = properties.ListItem;
                 spSite = new SPSite(properties.WebUrl.ToString());
                 web = spSite.OpenWeb();
                 project = properties.ListItem["Title"].ToString();
                
                 ListName = properties.ListTitle.ToString();
 
                 oldColumn1 = properties.ListItem["Title"].ToString();
 
                 try
                 {
                     //   newColumn1 = properties.AfterProperties["Title"].ToString();
                     newValue[0] = properties.AfterProperties[ColumnList[0]].ToString();
                     newValue[1] = properties.AfterProperties[ColumnList[1]].ToString();
                     newValue[2] = properties.AfterProperties[ColumnList[2]].ToString();
                 }
 
                 catch{}
                
                     //   newColumn1 = properties.AfterProperties["Title"].ToString();
                     try
                     {
                         AppValue[0] = properties.AfterProperties[AppList[0]].ToString();
                     }
                     catch { }
                     try
                     {
                         AppValue[1] = properties.AfterProperties[AppList[1]].ToString();
                     }
                     catch { }
                     try
                     {
                         AppValue[2] = properties.AfterProperties[AppList[2]].ToString();
                     }
                     catch { }
                     try
                     {
                         AppValue[3] = properties.AfterProperties[AppList[3]].ToString();
                     }
                     catch { }
                     try
                     {
                         AppValue[4] = properties.AfterProperties[AppList[4]].ToString();
                     }
                     catch { }
                     try
                     {
                         AppValue[5] = properties.AfterProperties[AppList[5]].ToString();
                     }
                     catch { }
                     try
                     {
                         AppValue[6] = properties.AfterProperties[AppList[6]].ToString();
                     }
                     catch { }
                     try
                     {
                         AppValue[7] = properties.AfterProperties[AppList[7]].ToString();
                     }
                     catch { }
                     try
                     {
                         AppValue[8] = properties.AfterProperties[AppList[8]].ToString();
                     }
                     catch { }
                     try
                     {
                         AppValue[9] = properties.AfterProperties[AppList[9]].ToString();
                     }
                     catch { }
                     try
                     {
                         AppValue[10] = properties.AfterProperties[AppList[10]].ToString();
                     }
                     catch { }
                     try
                     {
                         AppValue[11] = properties.AfterProperties[AppList[11]].ToString();
                     }
                     catch { }
                     try
                     {
                         AppValue[12] = properties.AfterProperties[AppList[12]].ToString();
                     }
                     catch { }
                     try
                     {
                         AppValue[13] = properties.AfterProperties[AppList[13]].ToString();
                     }
                     catch { }
                     try
                     {
                         AppValue[14] = properties.AfterProperties[AppList[14]].ToString();
                     }
                     catch { }
                     try
                     {
                         AppValue[15] = properties.AfterProperties[AppList[15]].ToString();
                     }
                     catch { }
                     try
                     {
                         AppValue[16] = properties.AfterProperties[AppList[16]].ToString();
                     }
                     catch { }
                     try
                     {
                         AppValue[17] = properties.AfterProperties[AppList[17]].ToString();
                     }
                     catch { }
                     try
                     {
                         AppValue[18] = properties.AfterProperties[AppList[18]].ToString();
                     }
                     catch { }
                     try
                     {
                         AppValue[19] = properties.AfterProperties[AppList[19]].ToString();
                     }
                     catch { }
                     try
                     {
                         AppValue[20] = properties.AfterProperties[AppList[20]].ToString();
                     }
                     catch { }
                     try
                     {
                         AppValue[21] = properties.AfterProperties[AppList[21]].ToString();
                     }
                     catch { }
                     try
                     {
                         AppValue[22] = properties.AfterProperties[AppList[22]].ToString();
                     }
                     catch { }
                     try
                     {
                         AppValue[23] = properties.AfterProperties[AppList[23]].ToString();
                     }
                     catch { }
                     try
                     {
                         AppValue[24] = properties.AfterProperties[AppList[24]].ToString();
                     }
                     catch { }
                     try
                     {
                         AppValue[25] = properties.AfterProperties[AppList[25]].ToString();
                     }
                     catch { }
                     try
                     {
                         AppValue[26] = properties.AfterProperties[AppList[26]].ToString();
                     }
                     catch { }
                     try
                     {
                         AppValue[27] = properties.AfterProperties[AppList[27]].ToString();
                     }
                     catch { }
                     try
                     {
                         AppValue[28] = properties.AfterProperties[AppList[28]].ToString();
                     }
                     catch { }
                     try
                     {
                         AppValue[29] = properties.AfterProperties[AppList[29]].ToString();
                     }
                     catch { }
                     try
                     {
                         AppValue[30] = properties.AfterProperties[AppList[30]].ToString();
                     }
                     catch { }
                     try
                     {
                         AppValue[31] = properties.AfterProperties[AppList[31]].ToString();
                     }
                     catch { }
                     try
                     {
                         AppValue[32] = properties.AfterProperties[AppList[32]].ToString();
                     }
                     catch { }
                     try
                     {
                         AppValue[33] = properties.AfterProperties[AppList[33]].ToString();
                     }
                     catch { }
                     try
                     {
                         AppValue[34] = properties.AfterProperties[AppList[34]].ToString();
                     }
                     catch { }
                     try
                     {
                         AppValue[35] = properties.AfterProperties[AppList[35]].ToString();
                     }
                     catch { }
                     try
                     {
                         AppValue[36] = properties.AfterProperties[AppList[36]].ToString();
                     }
                     catch { }
                     try
                     {
                         AppValue[37] = properties.AfterProperties[AppList[37]].ToString();
                     }
                     catch { }
                     try
                     {
                         AppValue[38] = properties.AfterProperties[AppList[38]].ToString();
                     }
                     catch { }
                     try
                     {
                         AppValue[39] = properties.AfterProperties[AppList[39]].ToString();
                     }
                     catch { }
                     try
                     {
                         AppValue[40] = properties.AfterProperties[AppList[40]].ToString();
                     }
                     catch { }
                     try
                     {
                         AppValue[41] = properties.AfterProperties[AppList[41]].ToString();
                     }
                     catch { }
                     try
                     {
                         AppValue[42] = properties.AfterProperties[AppList[42]].ToString();
                     }
                     catch { }
                     try
                     {
                         AppValue[43] = properties.AfterProperties[AppList[43]].ToString();
                     }
                     catch { }
                     try
                     {
                         AppValue[44] = properties.AfterProperties[AppList[44]].ToString();
                     }
                     catch { }
                     try
                     {
                         AppValue[45] = properties.AfterProperties[AppList[45]].ToString();
                     }
                     catch { }
                     try
                     {
                         AppValue[46] = properties.AfterProperties[AppList[46]].ToString();
                     }
                     catch { }
                     try
                     {
                         AppValue[47] = properties.AfterProperties[AppList[47]].ToString();
                     }
                     catch { }
                     try
                     {
                         AppValue[48] = properties.AfterProperties[AppList[48]].ToString();
                     }
                     catch { }
                     try
                     {
                         AppValue[49] = properties.AfterProperties[AppList[49]].ToString();
                     }
                     catch { }
                     try
                     {
                         AppValue[50] = properties.AfterProperties[AppList[50]].ToString();
                     }
                     catch { }
                     try
                     {
                         AppValue[51] = properties.AfterProperties[AppList[51]].ToString();
                     }
                     catch { }
                     try
                     {
                         AppValue[52] = properties.AfterProperties[AppList[52]].ToString();
                     }
                     catch { }
                     try
                     {
                         AppValue[53] = properties.AfterProperties[AppList[53]].ToString();
                     }
                     catch { }
                     try
                     {
                         AppValue[54] = properties.AfterProperties[AppList[54]].ToString();
                     }
                     catch { }
                     try
                     {
                         AppValue[55] = properties.AfterProperties[AppList[55]].ToString();
                     }
                     catch { }
                     try
                     {
                         AppValue[56] = properties.AfterProperties[AppList[56]].ToString();
                     }
                     catch { }
                     try
                     {
                         AppValue[57] = properties.AfterProperties[AppList[57]].ToString();
                     }
                     catch { }
                    
                 
                 try{
                     try
                     {
                         ESValue[0] = properties.AfterProperties[ESLSList[0]].ToString();
                     }
                     catch { }
                     try
                     {
                         ESValue[1] = properties.AfterProperties[ESLSList[1]].ToString();
                     }
                     catch { }
                     try
                     {
                         ESValue[2] = properties.AfterProperties[ESLSList[2]].ToString();
                     }
                     catch { }
                     try
                     {
                         ESValue[3] = properties.AfterProperties[ESLSList[3]].ToString();
                     }
                     catch { }
                     try
                     {
                         ESValue[4] = properties.AfterProperties[ESLSList[4]].ToString();
                     }
                     catch { }
                     try
                     {
                         ESValue[5] = properties.AfterProperties[ESLSList[5]].ToString();
                     }
                     catch { }
                     try
                     {
                         ESValue[6] = properties.AfterProperties[ESLSList[6]].ToString();
                     }
                     catch { }
                     try
                     {
                         ESValue[7] = properties.AfterProperties[ESLSList[7]].ToString();
                     }
                     catch { }
                     try
                     {
                         ESValue[8] = properties.AfterProperties[ESLSList[8]].ToString();
                     }
                     catch { }
                     try
                     {
                         ESValue[9] = properties.AfterProperties[ESLSList[9]].ToString();
                     }
                     catch { }
                     try
                     {
                         ESValue[10] = properties.AfterProperties[ESLSList[10]].ToString();
                     }
                     catch { }
                     try
                     {
                         ESValue[11] = properties.AfterProperties[ESLSList[11]].ToString();
                     }
                     catch { }
                     try
                     {
                         ESValue[12] = properties.AfterProperties[ESLSList[12]].ToString();
                     }
                     catch { }
                    
                 }
                 catch{}
                 try{
                     try
                     {
                         ESPValue[0] = properties.AfterProperties[ESPSList[0]].ToString();
                     }
                     catch { }
                     try
                     {
                         ESPValue[1] = properties.AfterProperties[ESPSList[1]].ToString();
                     }
                     catch { }
                     try
                     {
                         ESPValue[2] = properties.AfterProperties[ESPSList[2]].ToString();
                     }
                     catch { }
                     try
                     {
                         ESPValue[3] = properties.AfterProperties[ESPSList[3]].ToString();
                     }
                     catch { }
                     try
                     {
                         ESPValue[4] = properties.AfterProperties[ESPSList[4]].ToString();
                     }
                     catch { }
                     try
                     {
                         ESPValue[5] = properties.AfterProperties[ESPSList[5]].ToString();
                     }
                     catch { }
                     try
                     {
                         ESPValue[6] = properties.AfterProperties[ESPSList[6]].ToString();
                     }
                     catch { }
                     try
                     {
                         ESPValue[7] = properties.AfterProperties[ESPSList[7]].ToString();
                     }
                     catch { }
                     try
                     {
                         ESPValue[8] = properties.AfterProperties[ESPSList[8]].ToString();
                     }
                     catch { }
                     
                 }
                 catch { }
 
                 try
                 {
                     try
                     {
                         ESPValue[0] = properties.AfterProperties[ESPSListForMaster[0]].ToString();
                     }
                     catch { }
                     try
                     {
                         ESPValue[1] = properties.AfterProperties[ESPSListForMaster[1]].ToString();
                     }
                     catch { }
                     try
                     {
                         ESPValue[2] = properties.AfterProperties[ESPSListForMaster[2]].ToString();
                     }
                     catch { }
                     try
                     {
                         ESPValue[3] = properties.AfterProperties[ESPSListForMaster[3]].ToString();
                     }
                     catch { }
                     try
                     {
                         ESPValue[4] = properties.AfterProperties[ESPSListForMaster[4]].ToString();
                     }
                     catch { }
                     try
                     {
                         ESPValue[5] = properties.AfterProperties[ESPSListForMaster[5]].ToString();
                     }
                     catch { }
                     try
                     {
                         ESPValue[6] = properties.AfterProperties[ESPSListForMaster[6]].ToString();
                     }
                     catch { }
                     try
                     {
                         ESPValue[7] = properties.AfterProperties[ESPSListForMaster[7]].ToString();
                     }
                     catch { }
                     try
                     {
                         ESPValue[8] = properties.AfterProperties[ESPSListForMaster[8]].ToString();
                     }
                     catch { }
                  
 
                 }
                 catch { }
 
                 DataTable siteListTBL = GetDestinationSiteList();
 
 
 
 
 
 
                 if (siteListTBL.Rows.Count > 0)
                 {
                     foreach (DataRow dr in siteListTBL.Rows)
                     {
                         DestinationSite = dr["Title"].ToString();
 
                         otherspSite = new SPSite(DestinationSite);
                         otherweb = otherspSite.OpenWeb();
 
 
                         //First Column Update
                         if (ListName == "Projects List")
                         {
                             try
                             {
 
                                 DBUpdate = properties.AfterProperties["DBUpdate"].ToString();
                                 UpdateListItemToAnotherList(anItem, newValue, ColumnList);
                             }
                             catch { }
                             try
                             {
                                 DBUpdate = properties.AfterProperties["DBUpdate"].ToString();
                                
                                 UpdateListItemToAppList(anItem, AppValue, AppList);
                             }
                             catch { }
                             try
                             {
                                 DBUpdate = properties.AfterProperties["DBUpdate"].ToString();
                              //   ESLS_ServerName = properties.AfterProperties["ESLS_ServerName"].ToString();
                                 UpdateListItemToESLserverList(anItem, ESValue, ESLSMasterList);
                             }
                             catch { }
                             try
                             {
                                 DBUpdate = properties.AfterProperties["DBUpdate"].ToString();
                                 PSerialNumber = properties.AfterProperties["ESPS_PSerialNumber"].ToString();
                                 UpdateListItemToESPserverList(anItem, ESPValue, ESPSMasterList);
                             }
                             catch { }
                         }
                         //else
                         //{
 
                         //    UpdateListItemToAnotherListForLServer(anItem, newValue, ColumnList);
                         //}
 
 
                     }
                 }
             }
             );
 
            //SPListItem aitem = properties.ListItem;
            //string col1 = aitem["Title"].ToString();ack 
            //properties.AfterProperties[
            //SPList list1 = web.Lists["Test"];
            //SPListItem item1 = list1.Items[1];
            //item1["test"] = col1;
            //item1.Update();
 
       }
 
      
 
        public DataTable GetDestinationSiteList()
        {
            SPList list = web.Lists["DestSiteList"];
            SPSiteDataQuery objSPSiteDataQry = new SPSiteDataQuery();
            string strAdminListID = web.Lists["DestSiteList"].ID.ToString();
            objSPSiteDataQry.Lists = "<Lists><List ID=" + strAdminListID + "/></List>";
 
            objSPSiteDataQry.ViewFields = "<FieldRef Name='Title' />";
 
            DataTable siteListTable = web.GetSiteData(objSPSiteDataQry);
 
            return siteListTable;
        }
 
        public void UpdateListItemToAnotherList(SPListItem documentItem, string[] newColumnValue, string[] ColumnName)
        {
           // SPSite site = new SPSite("http://sv02/oracle/");
           // SPWeb web = site.OpenWeb();
           // SPList list = web.Lists["Test"];
 
                String FinalDispState;
                FinalDispState = "";
                SPList list = otherweb.Lists[DestinationList];
                SPQuery query1 = new SPQuery();
                query1.Query = "<OrderBy><FieldRef Name='Title' /><FieldRef Name='Phase' /><FieldRef Name='State' /><FieldRef Name='FinalDispState' /></OrderBy><Where><Eq><FieldRef Name='Title' /><Value Type='Text'>" + project + "</Value></Eq></Where>";
                //SPListItemCollection item1 = list.GetItems(query1);
                SPListItemCollection item = list.GetItems(query1);
                try
                {
                    foreach (SPListItem itemdata in item)
                    {
                        try
                        {
                            // itemdata["test"] = newItem;
                            FinalDispState = itemdata["FinalDispState"].ToString();
                            if (DBUpdate == "True" || DBUpdate == "1")
                            {
                                if (FinalDispState != "Initial Duplicate Server Data" && FinalDispState != "Non-EOSL Remediation Effort" && FinalDispState != "Invalid Server Data")
                                {
                                itemdata[ColumnName[0].ToString()] = newColumnValue[0];
                                itemdata[ColumnName[1].ToString()] = newColumnValue[1];
                                itemdata[ColumnName[2].ToString()] = newColumnValue[2];
 
                                itemdata.Update();
                                }
                            }
                        }
                        catch
                        { }
                    }
 
 
                }
                catch { }
        }
 
        public void UpdateListItemToAppList(SPListItem documentItem, string[] newColumnValue, string[] ColumnName)
        {
            // SPSite site = new SPSite("http://sv02/oracle/");
            // SPWeb web = site.OpenWeb();
            // SPList list = web.Lists["Test"];
 
 
            SPList list = otherweb.Lists["AppRemProjects"];
            SPQuery query1 = new SPQuery();
            query1.Query = "<OrderBy><FieldRef Name='Title' /><FieldRef Name='AppAcronym' /><FieldRef Name='Environment' /><FieldRef Name='I_SanImpact' /><FieldRef Name='I_SANGB' /><FieldRef Name='I_ServerCount' /><FieldRef Name='I_ITPrimaryAppContact' /><FieldRef Name='I_ITApplicationContact_x0023_' /><FieldRef Name='I_ITApplicationManager' /><FieldRef Name='I_ITApplicationManager_x0023_' /><FieldRef Name='I_GroupName' /><FieldRef Name='I_BIORep' /><FieldRef Name='I_KPHCCoSapplication_x003F_' /><FieldRef Name='I_MaintenanceWindow' /><FieldRef Name='I_OutageOK_x003F_BeyondMaintWind' /><FieldRef Name='I_MaxAllowableOutage' /><FieldRef Name='I_Middleware_x003F_' /><FieldRef Name='I_Web_x002d_Based_x003F_' /><FieldRef Name='I_DBType' /><FieldRef Name='I_DBSizeGB' /><FieldRef Name='I_DependencyonOtherApps_x002d_Se' /><FieldRef Name='I_AppReqDataTransfer_x003F_' /><FieldRef Name='I_SupportedByAIMS' /><FieldRef Name='I_AppServerPool' /><FieldRef Name='I_UpstreamInterfaces' /><FieldRef Name='I_AdditionalInformation' /><FieldRef Name='I_SrManager' /><FieldRef Name='I_AppRetirementDate' /><FieldRef Name='I_AppAvailSLA' /><FieldRef Name='ES_SANImpact' /><FieldRef Name='ES_SANGB' /><FieldRef Name='ES_ServerCount' /><FieldRef Name='ES_ITPrimaryAppContact' /><FieldRef Name='ES_ITApplicationContact_x0023_' /><FieldRef Name='ES_ITApplicationManager' /><FieldRef Name='ES_ITApplicationManager_x0023_' /><FieldRef Name='ES_GroupName' /><FieldRef Name='ES_BIORep' /><FieldRef Name='ES_KPHCCoSapplication_x003F_' /><FieldRef Name='ES_MaintenanceWind' /><FieldRef Name='ES_OutageOK_x003F_BeyondMaintWin' /><FieldRef Name='ES_MaxAllowableOutage' /><FieldRef Name='ES_Middleware_x003F_' /><FieldRef Name='ES_Web_x002d_Based_x003F_' /><FieldRef Name='ES_DBType' /><FieldRef Name='ES_DBSizeGB' /><FieldRef Name='ES_DependencyonOtherApps_x002d_S' /><FieldRef Name='ES_AppReqDataTransfer_x003F_' /><FieldRef Name='ES_AdditionalInformation' /><FieldRef Name='ES_SupportedByAIMS' /><FieldRef Name='ES_AppServerPool' /><FieldRef Name='ES_SrManager' /><FieldRef Name='ES_AppRetirementDate' /><FieldRef Name='ES_AppAvailSLA' /><FieldRef Name='ES_DownStreamInterfaces' /><FieldRef Name='ES_UpstreamInterfaces' /><FieldRef Name='I_DownstreamInterfaces' /></OrderBy><Where><Eq><FieldRef Name='Title' /><Value Type='Text'>" + project + "</Value></Eq></Where>";
            //SPListItemCollection item1 = list.GetItems(query1);
            SPListItemCollection item = list.GetItems(query1);
            try
            {
                foreach (SPListItem itemdata in item)
                {
                    try
                    {
                        // itemdata["test"] = newItem;
                        if (DBUpdate == "True" || DBUpdate == "1")
                        {
                           
                                try
                                {
                                    itemdata[ColumnName[0].ToString()] = newColumnValue[0];
                                }
                                catch { }
                                try
                                {
                                    itemdata[ColumnName[1].ToString()] = newColumnValue[1];
                                }
                                catch { }
                                try
                                {
                                itemdata[ColumnName[2].ToString()] = newColumnValue[2];
                                 }
                                catch { }
 
                                try
                                {
                                    try
                                    {
                                        itemdata[ColumnName[3].ToString()] = newColumnValue[3];
                                    }
                                    catch { }
                                    try
                                    {
                                        itemdata[ColumnName[4].ToString()] = newColumnValue[4];
                                    }
                                    catch { }
                                    try
                                    {
                                        itemdata[ColumnName[5].ToString()] = newColumnValue[5];
                                    }
                                    catch { }
                                    try
                                    {
                                        itemdata[ColumnName[6].ToString()] = newColumnValue[6];
                                    }
                                    catch { }
                                    try
                                    {
                                        itemdata[ColumnName[7].ToString()] = newColumnValue[7];
                                    }
                                    catch { }
                                    try
                                    {
                                        itemdata[ColumnName[8].ToString()] = newColumnValue[8];
                                    }
                                    catch { }
                                    try
                                    {
                                        itemdata[ColumnName[9].ToString()] = newColumnValue[9];
                                    }
                                    catch { }
                                    try
                                    {
                                        itemdata[ColumnName[10].ToString()] = newColumnValue[10];
                                    }
                                    catch { }
                                    try
                                    {
                                        itemdata[ColumnName[11].ToString()] = newColumnValue[11];
                                    }
                                    catch { }
                                    try
                                    {
                                        itemdata[ColumnName[12].ToString()] = newColumnValue[12];
                                    }
                                    catch { }
                                    try
                                    {
                                        itemdata[ColumnName[13].ToString()] = newColumnValue[13];
                                    }
                                    catch { }
                                    try
                                    {
                                        itemdata[ColumnName[14].ToString()] = newColumnValue[14];
                                    }
 
                                    catch { }
                                    try
                                    {
                                        itemdata[ColumnName[15].ToString()] = newColumnValue[15];
                                    }
                                    catch { }
                                    try
                                    {
                                        itemdata[ColumnName[16].ToString()] = newColumnValue[16];
                                    }
                                    catch { }
                                    try
                                    {
                                        itemdata[ColumnName[17].ToString()] = newColumnValue[17];
                                    }
                                    catch { }
                                    try
                                    {
                                        itemdata[ColumnName[18].ToString()] = newColumnValue[18];
                                    }
                                    catch { }
                                    try
                                    {
                                        itemdata[ColumnName[19].ToString()] = newColumnValue[19];
                                    }
                                    catch { }
                                    try
                                    {
                                        itemdata[ColumnName[20].ToString()] = newColumnValue[20];
                                    }
                                    catch { }
                                    try
                                    {
                                        itemdata[ColumnName[21].ToString()] = newColumnValue[21];
                                    }
                                    catch { }
                                    try
                                    {
                                        itemdata[ColumnName[22].ToString()] = newColumnValue[22];
                                    }
                                    catch { }
                                    try
                                    {
                                        itemdata[ColumnName[23].ToString()] = newColumnValue[23];
                                    }
                                    catch { }
                                    try
                                    {
                                        itemdata[ColumnName[24].ToString()] = newColumnValue[24];
                                    }
                                    catch { }
                                    try
                                    {
                                        itemdata[ColumnName[25].ToString()] = newColumnValue[25];
                                    }
                                    catch { }
                                    try
                                    {
                                        itemdata[ColumnName[26].ToString()] = newColumnValue[26];
                                    }
                                    catch { }
                                    try
                                    {
                                        itemdata[ColumnName[27].ToString()] = newColumnValue[27];
                                    }
                                    catch { }
                                    try
                                    {
                                        itemdata[ColumnName[28].ToString()] = newColumnValue[28];
                                    }
                                    catch { }
                                    try
                                    {
                                        itemdata[ColumnName[29].ToString()] = newColumnValue[29];
                                    }
                                    catch { }
                                    try
                                    {
                                        itemdata[ColumnName[30].ToString()] = newColumnValue[30];
                                    }
                                    catch { }
                                    try
                                    {
                                        itemdata[ColumnName[31].ToString()] = newColumnValue[31];
                                    }
                                    catch { }
                                    try
                                    {
                                        itemdata[ColumnName[32].ToString()] = newColumnValue[32];
                                    }
                                    catch { }
                                    try
                                    {
                                        itemdata[ColumnName[33].ToString()] = newColumnValue[33];
                                    }
                                    catch { }
                                    try
                                    {
                                        itemdata[ColumnName[34].ToString()] = newColumnValue[34];
                                    }
                                    catch { }
                                    try
                                    {
                                        itemdata[ColumnName[35].ToString()] = newColumnValue[35];
                                    }
                                    catch { }
                                    try
                                    {
                                        itemdata[ColumnName[36].ToString()] = newColumnValue[36];
                                    }
                                    catch { }
                                    try
                                    {
                                        itemdata[ColumnName[37].ToString()] = newColumnValue[37];
                                    }
                                    catch { }
                                    try
                                    {
                                        itemdata[ColumnName[38].ToString()] = newColumnValue[38];
                                    }
                                    catch { }
                                    try
                                    {
                                        itemdata[ColumnName[39].ToString()] = newColumnValue[39];
                                    }
                                    catch { }
                                    try
                                    {
                                        itemdata[ColumnName[40].ToString()] = newColumnValue[40];
                                    }
                                    catch { }
                                    try
                                    {
                                        itemdata[ColumnName[41].ToString()] = newColumnValue[41];
                                    }
                                    catch { }
                                    try
                                    {
                                        itemdata[ColumnName[42].ToString()] = newColumnValue[42];
                                    }
                                    catch { }
                                    try
                                    {
                                        itemdata[ColumnName[43].ToString()] = newColumnValue[43];
                                    }
                                    catch { }
                                    try
                                    {
                                        itemdata[ColumnName[44].ToString()] = newColumnValue[44];
                                    }
                                    catch { }
                                    try
                                    {
                                        itemdata[ColumnName[45].ToString()] = newColumnValue[45];
                                    }
                                    catch { }
                                    try
                                    {
                                        itemdata[ColumnName[46].ToString()] = newColumnValue[46];
                                    }
                                    catch { }
                                    try
                                    {
                                        itemdata[ColumnName[47].ToString()] = newColumnValue[47];
                                    }
                                    catch { }
                                    try
                                    {
                                        itemdata[ColumnName[48].ToString()] = newColumnValue[48];
                                    }
                                    catch { }
                                    try
                                    {
                                        itemdata[ColumnName[49].ToString()] = newColumnValue[49];
                                    }
                                    catch { }
                                    try
                                    {
                                        itemdata[ColumnName[50].ToString()] = newColumnValue[50];
                                    }
                                    catch { }
                                    try
                                    {
                                        itemdata[ColumnName[51].ToString()] = newColumnValue[51];
                                    }
                                    catch { }
                                    try
                                    {
                                        itemdata[ColumnName[52].ToString()] = newColumnValue[52];
                                    }
                                    catch { }
                                    try
                                    {
                                        itemdata[ColumnName[53].ToString()] = newColumnValue[53];
                                    }
                                    catch { }
                                    try
                                    {
                                        itemdata[ColumnName[54].ToString()] = newColumnValue[54];
                                    }
                                    catch { }
                                    try
                                    {
                                        itemdata[ColumnName[55].ToString()] = newColumnValue[55];
                                    }
                                    catch { }
                                    try
                                    {
                                        itemdata[ColumnName[56].ToString()] = newColumnValue[56];
                                    }
                                    catch { }
                                    try
                                    {
                                        itemdata[ColumnName[57].ToString()] = newColumnValue[57];
                                    }
                                    catch { }
 
 
 
 
                                    itemdata.Update();
                                }
                                catch { }
                        }
                    }
                    catch
                    { }
                }
 
 
            }
            catch { }
        }
 
 
        public void UpdateListItemToESLserverList(SPListItem documentItem, string[] newColumnValue, string[] ColumnName)
        {
            // SPSite site = new SPSite("http://sv02/oracle/");
            // SPWeb web = site.OpenWeb();
            // SPList list = web.Lists["Test"];
 
 
            SPList list = otherweb.Lists[ESLSDestinationList];
            SPQuery query1 = new SPQuery();
            query1.Query = "<OrderBy><FieldRef Name='Title' /><FieldRef Name='PSerialNumber' /><FieldRef Name='FQDN' /><FieldRef Name='PSerialNumber' /><FieldRef Name='IPAddress' /><FieldRef Name='Initial_x0020_Lserver' /><FieldRef Name='ESerialNumber' /><FieldRef Name='Environment' /><FieldRef Name='ExtStorage' /><FieldRef Name='IntStorage' /><FieldRef Name='Notes' /><FieldRef Name='OSName' /><FieldRef Name='OSVersion' /><FieldRef Name='CPUs' /><FieldRef Name='RAM' /></OrderBy><Where><Eq><FieldRef Name='Initial_x0020_Lserver' /><Value Type='Text'>" + project + "</Value></Eq></Where>";
            //SPListItemCollection item1 = list.GetItems(query1);
            SPListItemCollection item = list.GetItems(query1);
            try
            {
                foreach (SPListItem itemdata in item)
                {
                    try
                    {
                   //     PSerialNumber = itemdata["PSerialNumber"].ToString();
                        // itemdata["test"] = newItem;
                        if (DBUpdate == "True" || DBUpdate == "1")
                        {
                            try
                            {
                                itemdata[ColumnName[0].ToString()] = newColumnValue[0];
                            }
                            catch { }
                            try
                            {
                                itemdata[ColumnName[1].ToString()] = newColumnValue[1];
                            }
                            catch { }
                            try
                            {
                                itemdata[ColumnName[2].ToString()] = newColumnValue[2];
                            }
                            catch { }
                            try
                            {
                                itemdata[ColumnName[3].ToString()] = newColumnValue[3];
                            }
                            catch { }
                            try
                            {
                                itemdata[ColumnName[4].ToString()] = newColumnValue[4];
                            }
                            catch { }
                            try
                            {
                                itemdata[ColumnName[5].ToString()] = newColumnValue[5];
                            }
                            catch { }
                            try
                            {
                                itemdata[ColumnName[6].ToString()] = newColumnValue[6];
                            }
                            catch { }
                            try
                            {
                                itemdata[ColumnName[7].ToString()] = newColumnValue[7];
                            }
                            catch { }
                            try
                            {
                                itemdata[ColumnName[8].ToString()] = newColumnValue[8];
                            }
                            catch { }
                            try
                            {
                                itemdata[ColumnName[9].ToString()] = newColumnValue[9];
                            }
                            catch { }
                            try
                            {
                                itemdata[ColumnName[10].ToString()] = newColumnValue[10];
                            }
                            catch { }
                            try
                            {
                                itemdata[ColumnName[11].ToString()] = newColumnValue[11];
                            }
                            catch { }
                            try
                            {
                                itemdata[ColumnName[12].ToString()] = newColumnValue[12];
                            }
                            catch { }
 
                           
                            itemdata.Update();
 
                            
                        }
                    }
                    catch { }
                }
 
            }
            catch
            { }
 
        }
 
        public void UpdateListItemToESPserverList(SPListItem documentItem, string[] newColumnValue, string[] ColumnName)
        {
            // SPSite site = new SPSite("http://sv02/oracle/");
            // SPWeb web = site.OpenWeb();
            // SPList list = web.Lists["Test"];
 
 
            SPList list = otherweb.Lists["ES_PServer"];
            SPQuery query1 = new SPQuery();
            query1.Query = "<OrderBy><FieldRef Name='TotalCPUs' /><FieldRef Name='Owner' /><FieldRef Name='Title' /><FieldRef Name='TotalRAM' /><FieldRef Name='TotalIntStorage' /><FieldRef Name='LocRoom' /><FieldRef Name='LocFloor' /><FieldRef Name='LocGrid' /><FieldRef Name='Facility' /><FieldRef Name='Brand' /><FieldRef Name='Model' /></OrderBy><Where><Eq><FieldRef Name='Title' /><Value Type='Text'>" + PSerialNumber + "</Value></Eq></Where>";
            //SPListItemCollection item1 = list.GetItems(query1);
 
 
 
 
            SPListItemCollection item = list.GetItems(query1);
            try
            { 
                 
                foreach (SPListItem itemdata in item)
                {
                    try
                    {
            //            PSerialNumber = itemdata["PSerialNumber"];
                        // itemdata["test"] = newItem;
                        if (SPWeb.CurrentUser.LoginName == SPListItem["Owner"])
                        {
 
                            try
                            {
                                if (newColumnValue[0] == "")
                                {
                                    newColumnValue[0] = "0";
                                }
                                if (newColumnValue[1] == "")
                                {
                                    newColumnValue[1] = "0";
                                }
 
                                if (newColumnValue[2] == "")
                                {
                                    newColumnValue[2] = "0";
                                }
                                if (newColumnValue[3] == "")
                                {
                                    newColumnValue[3] = "TBD";
                                }
                                if (newColumnValue[4] == "")
                                {
                                    newColumnValue[4] = "TBD";
                                }
                                if (newColumnValue[5] == "")
                                {
                                    newColumnValue[5] = "TBD";
                                }
                                if (newColumnValue[6] == "")
                                {
                                    newColumnValue[6] = "TBD";
                                }
                                if (newColumnValue[7] == "")
                                {
                                    newColumnValue[7] = "TBD";
                                }
                                if (newColumnValue[8] == "")
                                {
                                    newColumnValue[8] = "TBD";
                                }
                            }
                            catch { }
 
                            if (DBUpdate == "True" || DBUpdate == "1")
                            {
                                try
                                {
                                    itemdata[ColumnName[0].ToString()] = newColumnValue[0];
                                }
                                catch { }
                                try
                                {
                                    itemdata[ColumnName[1].ToString()] = newColumnValue[1];
                                }
                                catch { }
                                try
                                {
                                    itemdata[ColumnName[2].ToString()] = newColumnValue[2];
                                }
                                catch { }
                                try
                                {
                                    itemdata[ColumnName[3].ToString()] = newColumnValue[3];
                                }
                                catch { }
                                try
                                {
                                    itemdata[ColumnName[4].ToString()] = newColumnValue[4];
                                }
                                catch { }
                                try
                                {
                                    itemdata[ColumnName[5].ToString()] = newColumnValue[5];
                                }
                                catch { }
                                try
                                {
                                    itemdata[ColumnName[6].ToString()] = newColumnValue[6];
                                }
                                catch { }
                                try
                                {
                                    itemdata[ColumnName[7].ToString()] = newColumnValue[7];
                                }
                                catch { }
                                try
                                {
                                    itemdata[ColumnName[8].ToString()] = newColumnValue[8];
                                }
                                catch { }
 
                                itemdata.Update();
 
                                //              UpdateListItemToESPserverList(anItem, ESPValue, ESPSMasterList);
                            }
                        }
                    }
                    catch { }
                }
 
            }
            catch
            { }
 
        }
 
 
        public void UpdateListItemToAnotherListForLServer(SPListItem documentItem, string[] newColumnValue, string[] ColumnName)
        {
            
          
                SPList list = otherweb.Lists[DestinationListForLServer];
                SPQuery query1 = new SPQuery();
                query1.Query = "<OrderBy><FieldRef Name='Title' /><FieldRef Name='Phase' /><FieldRef Name='State' /><FieldRef Name='FinalDispState' /></OrderBy><Where><Eq><FieldRef Name='Title' /><Value Type='Text'>" + project + "</Value></Eq></Where>";
                
                SPListItemCollection item = list.GetItems(query1);
 
              
                foreach (SPListItem itemdata in item)
                {
                   
                    itemdata[ColumnName[0].ToString()] = newColumnValue[0];
                    itemdata[ColumnName[1].ToString()] = newColumnValue[1];
                    itemdata[ColumnName[2].ToString()] = newColumnValue[2];
 
                    itemdata.Update();
                }
 
           
           
 
 
        }
 
 
    }
}

Open in new window

0
 

Author Comment

by:guessdip
ID: 24080113
HIii,
  One more thing I tried   ""  if (web.CurrentUser.LoginName == itemdata["Owner"].ToString()) ""
But in event i have mention "SPSecurity.RunWithElevatedPrivileges(delegate()" so every time i get current login name "Sharepoint//System" i need to match person who really loged in.


Thank you..
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 16

Accepted Solution

by:
raybies earned 500 total points
ID: 24082621
I'm not sure I completely understand the 1st issue with views. U don't really need to use views... just use the fields.

2nd issue is easy, just place a reference outside...

SPUser oUser = web.CurrentUser;

SPSecurity.RunWithElevatedPrivileges(delegate()....

 if (oUser.LoginName == itemdata["Owner"].ToString())....
0
 

Author Comment

by:guessdip
ID: 24089234
Yes, i solved the second issue but i also want to display message box when Condition is unmatch but i think in event we are not able to display message box.

For First Issue is very complecated..Same list has differenrt different Listview web parts..
0
 
LVL 16

Expert Comment

by:raybies
ID: 24093073
What's the question?
0
 

Author Comment

by:guessdip
ID: 24093231
Hii raybies,
  Exactly i made one event to update ListB,ListC, ListD,ListE from ListA. ListA has 80 Columns, And ListB,ListC,ListD has 20 20 columns.ListA has all  combine columns. So In Event I am updating Al List from ListA according to columns. Every List has one Common column.

Now I made Web part page and i used List View web part to Display 20 columns,So i made Four List view Webpart on same page from  same List A only columns is different. Now i just connected all web part. Now i have four Webpart to update ListB,ListC,ListD,So user can update ListA acoording to their requirement.
Now When i use Webpart1 then it will update List B.But after that I use Webpart2 to update ListC then i get error about "Retrive or Delete".. But if i use webpart1 then i dont get.. I think event is not close at that time.i dont know what to do??I just want to know i have to close event or what to do?
Let me know if you need more clarification.

And Thanks for helped me i got Answer so i will Accept AsSolution soon.
0
 
LVL 16

Expert Comment

by:raybies
ID: 24093315
Can't you just use 1 list and have views to accomplish listB-E?

Also you shouldn't have any trouble updating any number of lists just use a new reference

eg:
SPList listB = oWeb.List["ListB"];
SPList listC = oWeb.List["ListC"];
SPList listD = oWeb.List["ListD"];
....
0
 

Author Comment

by:guessdip
ID: 24093338
Hii raybies,
  i used different different reference to update. i am able to update number of lists from one list. but problem is when i make different different view on page and then try to update one by one  then i can get Access error. and i use Datasheetview to update List. i have fout datasheet view web part and all are connected and all refer to one list.

I use only one list to update B,C,D..I made four view from ListA on single page.
0
 
LVL 16

Expert Comment

by:raybies
ID: 24093446
DataSheet view + Event Handlers == No Good.

U have to click on 2 records then reload each time you make a change to a line.
0
 

Author Closing Comment

by:guessdip
ID: 31566419
Thanks Dude..
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

These days socially coordinated efforts have turned into a critical requirement for enterprises.
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa‚Ķ

792 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question