Ejemplo n.º 1
0
        private void lkCustomSalary_FindClick(object sender, EventArgs e)
        {
            string filter = "";
            ObservableCollection <object> paras = new ObservableCollection <object>();
            Dictionary <string, string>   cols  = new Dictionary <string, string>();

            cols.Add("GUERDONNAME", "GUERDONNAME");
            cols.Add("GUERDONSUM", "GUERDONSUM");
            cols.Add("UPDATEDATE", "UPDATEDATE");
            filter += "OWNERCOMPANYID==@" + paras.Count().ToString();
            paras.Add(SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.UserPosts[0].CompanyID);
            LookupForm lookup = new LookupForm(EntityNames.CustomGuerdonSet,
                                               typeof(List <T_HR_CUSTOMGUERDONSET>), cols, filter, paras);

            lookup.TitleContent   = Utility.GetResourceStr("CUSTOMSALARY");
            lookup.SelectedClick += (o, ev) =>
            {
                T_HR_CUSTOMGUERDONSET ent = lookup.SelectedObj as T_HR_CUSTOMGUERDONSET;
                if (!GetExit(ent.GUERDONNAME))
                {
                    if (ent != null)
                    {
                        lkCustomSalary.DataContext = ent;
                        T_HR_SALARYSTANDARD entSALARYSTANDARD = new T_HR_SALARYSTANDARD();
                        entSALARYSTANDARD.SALARYSTANDARDID  = SAVEID;
                        customGuerdon.CUSTOMGUERDONID       = Guid.NewGuid().ToString();
                        customGuerdon.T_HR_SALARYSTANDARD   = entSALARYSTANDARD;
                        customGuerdon.T_HR_CUSTOMGUERDONSET = ent;
                        customGuerdon.SUM        = ent.GUERDONSUM;
                        customGuerdon.CREATEDATE = System.DateTime.Now;

                        customGuerdon.OWNERCOMPANYID     = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.UserPosts[0].CompanyID;
                        customGuerdon.OWNERDEPARTMENTID  = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.UserPosts[0].DepartmentID;
                        customGuerdon.OWNERID            = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID;
                        customGuerdon.OWNERPOSTID        = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.UserPosts[0].PostID;
                        customGuerdon.CREATEUSERID       = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID;
                        customGuerdon.CREATECOMPANYID    = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.UserPosts[0].CompanyID;
                        customGuerdon.CREATEDEPARTMENTID = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.UserPosts[0].DepartmentID;
                        customGuerdon.CREATEPOSTID       = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.UserPosts[0].PostID;

                        client.CustomGuerdonAddAsync(customGuerdon);
                        RefreshUI(RefreshedTypes.ProgressBar);
                    }
                }
                else
                {
                    ent.GUERDONNAME            = "";// Utility.GetResourceStr("ALREADYEXISTS");
                    lkCustomSalary.DataContext = ent;
                    Utility.ShowCustomMessage(MessageTypes.Error, Utility.GetResourceStr("ERROR"), Utility.GetResourceStr("ALREADYEXISTS"));
                }
            };
            lookup.Show <string>(DialogMode.Default, SMT.SAAS.Main.CurrentContext.Common.ParentLayoutRoot, "", (result) => { });
        }