protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         string en_id = Request.QueryString["en_ID"].ToString();
         if (en_id != string.Empty)
         {
             HiddenField1.Value = en_id;
             using (SPSite site = new SPSite(MyConfiguration.GetSiteURL(SPContext.Current)))
             {
                 SPWeb  hrWeb      = site.AllWebs["HRMV02"];
                 SPList entitylist = hrWeb.Lists["Entity"];
                 //SPQuery qry_edit_entity = new SPQuery();
                 //qry_edit_entity.Query = @"<Where><Eq><FieldRef Name='ID'/><Value Type='Counter'>"+en_id+@"</Value></Eq></Where>";
                 SPListItem edit_entitylist_item = entitylist.GetItemById(Convert.ToInt32(en_id.ToString()));
                 txtbox_edit_EntityName.Text = edit_entitylist_item["Title"].ToString();
                 rbtn_EntityStatus.Items.Clear();
                 SPFieldChoice rbt_entity_status = new SPFieldChoice(edit_entitylist_item.Fields, "Status");
                 for (int i = 0; i <= (Convert.ToInt16(rbt_entity_status.Choices.Count.ToString()) - 1); i++)
                 {
                     rbtn_EntityStatus.Items.Add(rbt_entity_status.Choices[i].ToString());
                     if (rbtn_EntityStatus.Items[i].Text == edit_entitylist_item["Status"].ToString())
                     {
                         rbtn_EntityStatus.Items[i].Selected = true;
                         //rbtn_EntityStatus.Items[i].Attributes["AutoPostBack"] = "false";
                     }
                 }
             }
         }
     }
 }
        protected void btn_Cancel_Entity_update_Click(object sender, EventArgs e)
        {
            SPSite site  = new SPSite(MyConfiguration.GetSiteURL(SPContext.Current));
            SPWeb  hrweb = site.AllWebs["HRMV02"];

            Response.Redirect(hrweb.Url.ToString());
        }
 protected SPDataSource entityds()
 {
     using (SPSite site = new SPSite(MyConfiguration.GetSiteURL(SPContext.Current)))
     {
         SPWeb        hrWeb    = site.AllWebs["HRMV02"];
         SPDataSource entityds = new SPDataSource();
         entityds.List = hrWeb.Lists["Entity"];
         return(entityds);
     }
 }
Beispiel #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string siteurl      = MyConfiguration.GetSiteURL(SPContext.Current);
            var    Resource_Svc = new Resource();

            Resource_Svc.AllowAutoRedirect     = true;
            Resource_Svc.UseDefaultCredentials = true;
            Resource_Svc.Url      = siteurl + "/_vti_bin/psi/resource.asmx";
            LblCurrentResUID.Text = Resource_Svc.GetCurrentUserUid().ToString();
            //LblCurrentResUID.Text = "6FF0A657-63BC-4390-8AAF-7EE5CE033088";
        }
        protected void btn_Save_Entity_update_Click(object sender, EventArgs e)
        {
            string cusiteurl = string.Empty;

            using (SPSite site = new SPSite(MyConfiguration.GetSiteURL(SPContext.Current)))
            {
                SPWeb hrWeb = site.AllWebs["HRMV02"];
                cusiteurl = hrWeb.Url.ToString();
                hrWeb.AllowUnsafeUpdates = true;
                SPList     entitylist           = hrWeb.Lists["Entity"];
                SPListItem edit_entitylist_item = entitylist.GetItemById(Convert.ToInt32(HiddenField1.Value.ToString()));
                edit_entitylist_item["Title"]  = txtbox_edit_EntityName.Text;
                edit_entitylist_item["Status"] = rbtn_EntityStatus.SelectedValue.ToString();
                edit_entitylist_item.Update();
            }
            Response.Redirect(cusiteurl);
        }
Beispiel #6
0
        protected void Approve_Click(object sender, EventArgs e)
        {
            if (IsPostBack)
            {
                string siteurl = MyConfiguration.GetSiteURL(SPContext.Current);

                var Resource_Svc = new Resource();
                Resource_Svc.AllowAutoRedirect     = true;
                Resource_Svc.UseDefaultCredentials = true;
                Resource_Svc.Url = siteurl + "/_vti_bin/psi/resource.asmx";

                var Timesheet_Svc = new TimeSheet();
                Timesheet_Svc.AllowAutoRedirect     = true;
                Timesheet_Svc.UseDefaultCredentials = true;
                Timesheet_Svc.Url = siteurl + "/_vti_bin/psi/timesheet.asmx";

                string[] selectedtsuids = Request.Form["LstSelectedtsuids"].Split('#');
                if (selectedtsuids.Length > 0)
                {
                    var grouped_tsuids = (from c in selectedtsuids
                                          group c by c).ToList();
                    foreach (IGrouping <string, string> tsuid_str in grouped_tsuids)
                    {
                        if (tsuid_str.Key != string.Empty)
                        {
                            try
                            {
                                var tsuid        = new Guid(tsuid_str.Key);
                                var jobUID       = Guid.NewGuid();
                                var nextapprover = Resource_Svc.GetCurrentUserUid();
                                Timesheet_Svc.QueueReviewTimesheet(jobUID, tsuid, nextapprover,
                                                                   "Approving using utility",
                                                                   ITXProjectsLibrary.WebSvcTimeSheet.Action.Approve);
                            }
                            catch (Exception ex)
                            {
                                MyConfiguration.ErrorLog("Error at approving timesheet due to " + ex.Message,
                                                         EventLogEntryType.Error);
                            }
                        }
                    }
                }
                LblStatus.Text = "Timesheet approval process completed successfully.";
            }
        }
 protected SPDataSource resdetailds(int resfilterid)
 {
     using (SPSite site = new SPSite(MyConfiguration.GetSiteURL(SPContext.Current)))
     {
         SPWeb        hrWeb    = site.AllWebs["HRMV02"];
         SPDataSource resdetds = new SPDataSource();
         resdetds.SelectCommand = @"<Query>
                                     <Where>
                                         <Eq>
                                             <FieldRef Name='Department' LookupId='True' />
                                             <Value Type='Lookup'>" + resfilterid + @"</Value>
                                         </Eq>
                                     </Where>
                                 </Query>";
         resdetds.List          = hrWeb.Lists["Resource Details"];
         return(resdetds);
     }
 }
 protected SPDataSource deptds(int deptid)
 {
     using (SPSite site = new SPSite(MyConfiguration.GetSiteURL(SPContext.Current)))
     {
         SPWeb        hrWeb  = site.AllWebs["HRMV02"];
         SPDataSource deptds = new SPDataSource();
         deptds.SelectCommand = @"<Query>
                                     <Where>
                                         <Eq>
                                             <FieldRef Name='Entity' LookupId='True'/>
                                             <Value Type='Lookup'>" + deptid + @"</Value>
                                         </Eq>
                                     </Where>
                                 </Query>";
         deptds.List          = hrWeb.Lists["Department"];
         return(deptds);
     }
 }