Пример #1
0
        public bool INS_UPD_PROJECT(VM_Porject vm)
        {
            MyDatabaseClass objdb = new MyDatabaseClass();
            bool            hasExceptionThrown = false;
            string          errorMessage       = "";
            SortedList      sl      = new SortedList();
            int             counter = 0;

            try
            {
                if (vm.PROJECT_UID == 0)
                {
                    //string maxid = objdb.GetSingleValue("select max(PROJECT_UID) from project_mast", ref hasExceptionThrown, ref errorMessage);
                    //if (maxid == "") maxid = "0";
                    //maxid = (Convert.ToInt32(maxid) + 1).ToString();
                    string sql = "insert into project_mast(PROJECT_CODE,PROJECT_NAME,DOMAIN,START_DATE,END_DATE,STATUS,ENTRY_DATE) values ('" + vm.PROJECT_CODE + "','" + vm.PROJECT_NAME + "','" + vm.DOMAIN + "',convert(date,'" + vm.START_DATE + "',103),convert(date,'" + vm.END_DATE + "',103),'A',GETDATE())";
                    sl.Add(counter, sql); counter++;
                    // string[] emps = vm.EMP_CODE.ToString().Split(',');
                    for (int i = 0; i < vm.EMP_CODE.Length; i++)
                    {
                        sql = "insert into project_team (PROJECT_CODE,EMP_CODE,EMP_TYPE,STATUS,ENTRY_DATE,ENTRY_BY) values ('" + vm.PROJECT_CODE + "','" + vm.EMP_CODE[i].ToString() + "','PMPL','A',GETDATE(),00584)";
                        sl.Add(counter, sql); counter++;
                    }
                    objdb.GetRowsAffected(sl, ref hasExceptionThrown, ref errorMessage);
                }
                else
                {
                    string sql = "update project_mast set PROJECT_CODE='" + vm.PROJECT_CODE + "',PROJECT_NAME='" + vm.PROJECT_NAME + "',DOMAIN='" + vm.DOMAIN + "',START_DATE=convert(date,'" + vm.START_DATE + "',103),END_DATE=convert(date,'" + vm.END_DATE + "',103) where project_uid=" + vm.PROJECT_UID + "";
                    sl.Add(counter, sql); counter++;
                    sql = "delete from project_details where PROJECT_UID=" + vm.PROJECT_UID + "";
                    sl.Add(counter, sql); counter++;
                    //string[] emps = vm.EMP_CODE.ToString().Split(',');
                    for (int i = 0; i < vm.EMP_CODE.Length; i++)
                    {
                        sql = "insert into project_details(PROJECT_CODE,EMP_CODE,EMP_TYPE,STATUS,ENTRY_DATE,ENTRY_BY) values ('" + vm.PROJECT_CODE + "','" + vm.EMP_CODE[i].ToString() + "','PMPL','A',GETDATE(),00584)";
                        sl.Add(counter, sql); counter++;
                    }
                    objdb.GetRowsAffected(sl, ref hasExceptionThrown, ref errorMessage);
                }

                return(true);
            }
            catch (Exception ex)
            {
                return(false);

                throw;
            }
        }
Пример #2
0
        public bool DELETE_PROJECT(string PROJECT_UID)
        {
            MyDatabaseClass objdb = new MyDatabaseClass();
            bool            hasExceptionThrown = false;
            string          errorMessage       = "";
            SortedList      sl      = new SortedList();
            int             counter = 0;

            try
            {
                string sql = "update project_mast set status='D' where PROJECT_CODE='" + PROJECT_UID + "'";
                sl.Add(counter, sql); counter++;

                sql = "update project_team set  STATUS='D' where PROJECT_CODE='" + PROJECT_UID + "'";
                sl.Add(counter, sql); counter++;

                objdb.GetRowsAffected(sl, ref hasExceptionThrown, ref errorMessage);

                return(true);
            }
            catch (Exception ex)
            {
                return(false);

                throw;
            }
        }