Esempio n. 1
0
        public UserModel RegisterUser([FromBody] UserModel userMod)

        {
            UserModel resultMod = new UserModel();
            int       result;

            using (DataManager odm = new DataManager())

            {
                odm.Add("@pUserId", SqlDbType.Int, ParameterDirection.InputOutput, userMod.userId);
                odm.Add("@pName", SqlDbType.VarChar, 20, userMod.name.Trim());
                odm.Add("@pEmail", SqlDbType.NVarChar, 20, userMod.email.Trim());
                odm.Add("@pPassword", SqlDbType.NVarChar, 20, userMod.password.Trim());
                odm.CommandType = CommandType.StoredProcedure;

                result = odm.ExecuteNonQuery("User_Save");
            }
            if (result == -1)
            {
                resultMod.Message = "Sign Up Successfull";
                resultMod.result  = true;
                return(resultMod);
            }
            else
            {
                resultMod.Message = "Sign Up Failed!";
                resultMod.result  = false;
                return(resultMod);
            }
        }
Esempio n. 2
0
        private List <ResultModel> reqResult(ResultModel reqMod)

        {
            List <ResultModel> ansList = new List <ResultModel>();

            using (DataManager oDm = new DataManager())
            {
                oDm.Add("@pUserId", SqlDbType.VarChar, 50, reqMod.userId);
                oDm.Add("@pCategoryName", SqlDbType.VarChar, 50, reqMod.categoryName.Trim());
                oDm.CommandType = CommandType.StoredProcedure;
                SqlDataReader dr = oDm.ExecuteReader("Result_GetByCategory");

                if (dr.HasRows && dr != null)
                {
                    while (dr.Read())
                    {
                        ResultModel sendMod = new ResultModel();
                        sendMod.userId = (dr["UserId"] == DBNull.Value) ? 0 : Convert.ToInt32(dr["UserId"]);
                        sendMod.result = (dr["Result"] == DBNull.Value) ? "" : dr["Result"].ToString().Trim();
                        sendMod.date   = (dr["Date"] == DBNull.Value) ? "" : dr["Date"].ToString().Trim();
                        ansList.Add(sendMod);
                    }
                }
            }
            return(ansList);
        }
Esempio n. 3
0
        public static DataTable GetAll(int districtid, int stateid)
        {
            using (DataManager oDm = new DataManager())
            {
                if (districtid == 0)
                {
                    oDm.Add("@DistrictId", SqlDbType.Int, ParameterDirection.Input, DBNull.Value);
                }
                else
                {
                    oDm.Add("@DistrictId", SqlDbType.Int, ParameterDirection.Input, districtid);
                }

                if (stateid == 0)
                {
                    oDm.Add("@StateId", SqlDbType.Int, ParameterDirection.Input, DBNull.Value);
                }
                else
                {
                    oDm.Add("@StateId", SqlDbType.Int, ParameterDirection.Input, stateid);
                }

                oDm.CommandType = CommandType.StoredProcedure;
                return(oDm.ExecuteDataTable("Block_GetAll"));
            }
        }
Esempio n. 4
0
        /// <summary>
        /// AddEdit notification
        /// </summary>
        public bool AddEdit(Notification notification)
        {
            bool result = false;

            using (DataManager dataManager = new DataManager(ConnectionString))
            {
                dataManager.ExecuteString = "msg.Notifications_AddEdit";
                dataManager.Add("@Id", SqlDbType.UniqueIdentifier, ParameterDirection.Input, notification.Id);
                dataManager.Add("@Subject", SqlDbType.NVarChar, ParameterDirection.Input, notification.Subject);
                dataManager.Add("@Message", SqlDbType.NVarChar, ParameterDirection.Input, notification.Message);
                dataManager.Add("@NotificationType", SqlDbType.Int, ParameterDirection.Input, notification.NotificationType);
                dataManager.Add("@UserId", SqlDbType.UniqueIdentifier, ParameterDirection.Input, notification.UserId);
                dataManager.Add("@EntityId", SqlDbType.UniqueIdentifier, ParameterDirection.Input, notification.EntityId);
                dataManager.Add("@EntityType", SqlDbType.Int, ParameterDirection.Input, notification.EntityType);
                dataManager.Add("@CreatedOn", SqlDbType.DateTime, ParameterDirection.Input, notification.CreatedOn != DateTime.MinValue ? notification.CreatedOn : DateTime.Now);
                dataManager.Add("@IsReceived", SqlDbType.Bit, ParameterDirection.Input, notification.IsReceived);
                dataManager.Add("@ReceivedOn", SqlDbType.DateTime, ParameterDirection.Input, notification.ReceivedOn);

                dataManager.ExecuteNonQuery();

                result = true;
            }

            return(result);
        }
Esempio n. 5
0
        public List <ResultModel> GetUserResult(int userId, int categoryId)
        {
            List <ResultModel> resultList = new List <ResultModel>();

            using (DataManager odm = new DataManager())
            {
                odm.Add("@pUserId", SqlDbType.Int, userId);
                odm.Add("@pCategoryId", SqlDbType.Int, categoryId);
                odm.CommandType = CommandType.StoredProcedure;

                SqlDataReader dr = odm.ExecuteReader("Result_get");

                if (dr.HasRows)
                {
                    while (dr.Read())
                    {
                        resultList.Add(new ResultModel
                        {
                            userId       = (dr["UserId"] == DBNull.Value) ? 0 : Convert.ToInt32(dr["UserId"]),
                            resultId     = (dr["ResultId"] == DBNull.Value) ? 0 : Convert.ToInt32(dr["ResultId"]),
                            categoryId   = (dr["CategoryId"] == DBNull.Value) ? 0 : Convert.ToInt32(dr["CategoryId"]),
                            categoryName = (dr["CategoryName"] == DBNull.Value) ? "" : dr["CategoryName"].ToString().Trim(),
                            result       = (dr["Result"] == DBNull.Value) ? "" : dr["Result"].ToString().Trim(),
                            date         = (dr["Date"] == DBNull.Value) ? "" : dr["Date"].ToString().Trim(),
                            isNull       = false
                        });
                    }
                }
                return(resultList);
            }
        }
Esempio n. 6
0
        public void TestDataManager()
        {
            DataManager <TestStringId> dm = new DataManager <TestStringId>();

            dm.Provider = new LocalDataProvider <TestStringId>();

            dm.Clear();
            var testIdObj = new TestStringId {
                Id = "hello", Name = "world", MyList = { "abc", "def" }
            };

            dm.Add(testIdObj);
            dm.Add(new TestStringId {
                Id = "hello1", Name = "world1", MyList = { "abcd", "defg" }
            });
            dm.Add(new TestStringId {
                Id = "hello2", Name = "world2", MyList = { "1abc", "2def" }
            });

            Assert.AreEqual(dm.GetAll().Count(), 3);

            var obj = dm.GetById("hello1");

            Assert.AreEqual(obj.Name, "world1");
        }
 public static DataTable AllFees(Entity.Accounts.StreamGroup stremGroup)
 {
     using (DataManager oDm = new DataManager())
     {
         oDm.CommandType = CommandType.StoredProcedure;
         oDm.Add("@int_mode", SqlDbType.Int, stremGroup.intMode);
         if (stremGroup.courseID == 0)
         {
             oDm.Add("@courseID", SqlDbType.Int, DBNull.Value);
         }
         else
         {
             oDm.Add("@courseID", SqlDbType.Int, stremGroup.courseID);
         }
         if (stremGroup.intCompanyId == 0)
         {
             oDm.Add("@int_company_id", SqlDbType.Int, DBNull.Value);
         }
         else
         {
             oDm.Add("@int_company_id", SqlDbType.Int, stremGroup.intCompanyId);
         }
         return(oDm.ExecuteDataTable("usp_fees_insert"));
     }
 }
        public static DataTable GetAll(string Name, string MobileNo)
        {
            using (DataManager oDm = new DataManager())
            {
                if (Name.Trim().Length > 0)
                {
                    oDm.Add("@Name", SqlDbType.VarChar, 100, Name);
                }
                else
                {
                    oDm.Add("@Name", SqlDbType.VarChar, 100, DBNull.Value);
                }

                if (MobileNo.Trim().Length > 0)
                {
                    oDm.Add("@MobileNo", SqlDbType.VarChar, 30, MobileNo);
                }
                else
                {
                    oDm.Add("@MobileNo", SqlDbType.VarChar, 30, DBNull.Value);
                }

                oDm.CommandType = CommandType.StoredProcedure;
                return(oDm.ExecuteDataTable("usp_GeneralMember_GetAll"));
            }
        }
        public static DataTable GetAll(string EmpCode, string FirstName)
        {
            using (DataManager oDm = new DataManager())
            {
                if (EmpCode.Trim().Length == 0)
                {
                    oDm.Add("@pEmpCode", SqlDbType.VarChar, 100, DBNull.Value);
                }
                else
                {
                    oDm.Add("@pEmpCode", SqlDbType.VarChar, 100, EmpCode);
                }

                if (FirstName.Trim().Length == 0)
                {
                    oDm.Add("@pFirstName", SqlDbType.VarChar, 100, DBNull.Value);
                }
                else
                {
                    oDm.Add("@pFirstName", SqlDbType.VarChar, 100, FirstName);
                }

                oDm.CommandType = CommandType.StoredProcedure;
                return(oDm.ExecuteDataTable("usp_Employee_GetAll"));
            }
        }
Esempio n. 10
0
        public static DataSet  GetStudentOutstandingReport(int StudentId, string FromDate, string ToDate)
        {
            using (DataManager oDm = new DataManager())
            {
                oDm.CommandType = CommandType.StoredProcedure;
                oDm.Add("@MemberId", SqlDbType.Int, StudentId);
                if (FromDate.Trim().Length > 0)
                {
                    oDm.Add("@FromDate", SqlDbType.DateTime, Convert.ToDateTime(FromDate + " 00:00:00"));
                }
                else
                {
                    oDm.Add("@FromDate", SqlDbType.DateTime, DBNull.Value);
                }

                if (ToDate.Trim().Length > 0)
                {
                    oDm.Add("@ToDate", SqlDbType.DateTime, Convert.ToDateTime(ToDate + " 23:59:59"));
                }
                else
                {
                    oDm.Add("@ToDate", SqlDbType.DateTime, DBNull.Value);
                }

                DataSet ds = new DataSet();
                return(oDm.GetDataSet("usp_GetMemberOutstandingReport", ref ds, "tbl"));
            }
        }
Esempio n. 11
0
        public static DataTable GetAll(string FromDate, string ToDate)
        {
            using (DataManager oDm = new DataManager())
            {
                if (FromDate.Trim().Length == 0)
                {
                    oDm.Add("@pFromDate", SqlDbType.DateTime, ParameterDirection.Input, DBNull.Value);
                }
                else
                {
                    oDm.Add("@pFromDate", SqlDbType.DateTime, ParameterDirection.Input, Convert.ToDateTime(FromDate));
                }

                if (ToDate.Trim().Length == 0)
                {
                    oDm.Add("@pToDate", SqlDbType.DateTime, ParameterDirection.Input, DBNull.Value);
                }
                else
                {
                    oDm.Add("@pToDate", SqlDbType.DateTime, ParameterDirection.Input, Convert.ToDateTime(ToDate));
                }

                oDm.CommandType = CommandType.StoredProcedure;
                return(oDm.ExecuteDataTable("usp_SMSTrigger_GetAll"));
            }
        }
Esempio n. 12
0
 public static DataTable GetAuditTrailLogs(int UserId, int ActionType)
 {
     using (DataManager oDm = new DataManager())
     {
         oDm.CommandType = CommandType.StoredProcedure;
         oDm.Add("@pUserId", SqlDbType.Int, UserId);
         oDm.Add("@pActionType", SqlDbType.Int, ActionType);
         return(oDm.ExecuteDataTable("Common_ActivityLog_GetAll"));
     }
 }
 public static DataTable GetAllFeesHeadById(int feesId)
 {
     using (DataManager oDm = new DataManager())
     {
         oDm.CommandType = CommandType.StoredProcedure;
         oDm.Add("@feesID", SqlDbType.Int, feesId);
         oDm.Add("@int_mode", SqlDbType.Int, 15);
         return(oDm.ExecuteDataTable("usp_fees_insert"));
     }
 }
 public static DataTable AuthenticateUser(string UserName, string Mode)
 {
     using (DataManager oDm = new DataManager())
     {
         oDm.Add("@pUserName", SqlDbType.VarChar, 50, UserName);
         oDm.Add("@pMode", SqlDbType.VarChar, 50, Mode);
         oDm.CommandType = CommandType.StoredProcedure;
         return(oDm.ExecuteDataTable("usp_GetUserNameAndPass"));
     }
 }
 public static DataTable FeesBasedOnID(Entity.Accounts.StreamGroup stremGroup)
 {
     using (DataManager oDm = new DataManager())
     {
         oDm.CommandType = CommandType.StoredProcedure;
         oDm.Add("@int_mode", SqlDbType.Int, stremGroup.intMode);
         oDm.Add("@feesID", SqlDbType.Int, stremGroup.feesID);
         return(oDm.ExecuteDataTable("usp_fees_insert"));
     }
 }
        public void ProductTypesDelete(Guid gID)
        {
            using (var oDm = new DataManager())
            {
                oDm.Add("@ID", SqlDbType.UniqueIdentifier, gID);
                oDm.Add("@MODIFIED_USER_ID", SqlDbType.UniqueIdentifier, Security.USER_ID);

                oDm.CommandType = CommandType.StoredProcedure;
                oDm.ExecuteNonQuery("stp_Zpro_PRODUCT_TYPES_Delete");
            }
        }
        public static void ChangePriority(int MemberId, int Priority)
        {
            using (DataManager oDm = new DataManager())
            {
                oDm.Add("@MemberId", SqlDbType.Int, MemberId);
                oDm.Add("@Priority", SqlDbType.Int, Priority);

                oDm.CommandType = CommandType.StoredProcedure;
                oDm.ExecuteNonQuery("usp_Member_ChangePriority");
            }
        }
Esempio n. 18
0
        public static void ChangePassword(int AgentId, string AgentPassword)
        {
            using (DataManager oDm = new DataManager())
            {
                oDm.Add("@pAgentId", SqlDbType.Int, AgentId);
                oDm.Add("@pAgentPassword", SqlDbType.VarChar, 50, AgentPassword);

                oDm.CommandType = CommandType.StoredProcedure;
                oDm.ExecuteNonQuery("usp_AgentMaster_ChangePassword");
            }
        }
        public void ProductMassDelete(string sID_LIST)
        {
            using (var oDm = new DataManager())
            {
                oDm.Add("@ID_LIST", SqlDbType.VarChar, 8000, sID_LIST);
                oDm.Add("@MODIFIED_USER_ID", SqlDbType.UniqueIdentifier, Security.USER_ID);

                oDm.CommandType = CommandType.StoredProcedure;
                oDm.ExecuteNonQuery("stp_Zpro_PRODUCTS_MassDelete");
            }
        }
        public void ProductDelete(Guid gID)
        {
            using (var oDm = new DataManager())
            {
                oDm.Add("@ID", SqlDbType.UniqueIdentifier, gID);
                oDm.Add("@MODIFIED_USER_ID", SqlDbType.UniqueIdentifier, Security.USER_ID);

                oDm.CommandType = CommandType.StoredProcedure;
                oDm.ExecuteNonQuery("stp_Zpro_PRODUCTS_Delete");
            }
        }
Esempio n. 21
0
 public static DataTable GetRateByDay(int day, int month, string DistrictName)
 {
     using (DataManager oDm = new DataManager())
     {
         oDm.Add("@pDay", SqlDbType.Int, day);
         oDm.Add("@pMonth", SqlDbType.Int, month);
         oDm.Add("@pDistrictName", SqlDbType.VarChar, DistrictName);
         oDm.CommandType = CommandType.StoredProcedure;
         return(oDm.ExecuteDataTable("usp_birdprice_GetAllbirdpriceByDay"));
     }
 }
Esempio n. 22
0
        public static void Approve(int PaymentId, int ApprovedBy)
        {
            using (DataManager oDm = new DataManager())
            {
                oDm.Add("@pPaymentId", SqlDbType.Int, PaymentId);
                oDm.Add("@pApprovedBy", SqlDbType.Int, ApprovedBy);

                oDm.CommandType = CommandType.StoredProcedure;
                oDm.ExecuteNonQuery("usp_MemberPayment_Approve");
            }
        }
Esempio n. 23
0
        public static DataTable GetDueBills(int SupplierLedgerID_FK, int CompanyID_FK)
        {
            using (DataManager oDm = new DataManager())
            {
                oDm.Add("@SupplierLedgerID_FK", SqlDbType.Int, SupplierLedgerID_FK);
                oDm.Add("@CompanyID_FK", SqlDbType.Int, CompanyID_FK);

                oDm.CommandType = CommandType.StoredProcedure;
                return(oDm.ExecuteDataTable("usp_PurchaseBillPayment_GetDueBills"));
            }
        }
Esempio n. 24
0
        public static void Save(Entity.Common.MembershipCategoryFeesConfig config)
        {
            using (DataManager oDm = new DataManager())
            {
                oDm.Add("@pMembershipCategoryId", SqlDbType.Int, config.MembershipCategoryId);
                oDm.Add("@pFeesXml", SqlDbType.Xml, config.FeesXml);

                oDm.CommandType = CommandType.StoredProcedure;
                oDm.ExecuteNonQuery("usp_MembershipCategoryFeesConfig_Save");
            }
        }
Esempio n. 25
0
        public static int MemberMaster_Priority_Update(int memberid, bool ispriority)
        {
            using (DataManager oDm = new DataManager())
            {
                oDm.Add("@MemberId", SqlDbType.Int, ParameterDirection.Input, memberid);
                oDm.Add("@IsPriority", SqlDbType.Bit, ParameterDirection.Input, ispriority);

                oDm.CommandType = CommandType.StoredProcedure;
                return(oDm.ExecuteNonQuery("usp_MemberMaster_Priority_Update"));
            }
        }
Esempio n. 26
0
        public static int SMSSubscription_Block(int memberId, bool isBlock)
        {
            using (DataManager oDm = new DataManager())
            {
                oDm.Add("@MemberId", SqlDbType.Int, ParameterDirection.Input, memberId);
                oDm.Add("@IsBlock", SqlDbType.Bit, ParameterDirection.Input, isBlock);

                oDm.CommandType = CommandType.StoredProcedure;
                return(oDm.ExecuteNonQuery("usp_SMSSubscription_Block"));
            }
        }
Esempio n. 27
0
        public static void MemberApprove(int MemberId, int CreatedBy)
        {
            using (DataManager oDm = new DataManager())
            {
                oDm.Add("@pMemberId", SqlDbType.Int, MemberId);
                oDm.Add("@pCreatedBy", SqlDbType.Int, CreatedBy);

                oDm.CommandType = CommandType.StoredProcedure;
                oDm.ExecuteNonQuery("usp_MemberMaster_Approve");
            }
        }
        public void ProductMassDelete(string sID_LIST)
        {
            using (var oDm = new DataManager())
            {
                oDm.Add("@ID_LIST", SqlDbType.VarChar, 8000, sID_LIST);
                oDm.Add("@MODIFIED_USER_ID", SqlDbType.UniqueIdentifier, Security.USER_ID);

                oDm.CommandType = CommandType.StoredProcedure;
                oDm.ExecuteNonQuery("stp_Zpro_PRODUCTS_MassDelete");
            }
        }
 public static DataTable GetMonthlyPTaxRegister(int Month, int Year, int CompanyId)
 {
     using (DataManager oDm = new DataManager())
     {
         oDm.Add("@Month", SqlDbType.Int, Month);
         oDm.Add("@Year", SqlDbType.Int, Year);
         oDm.Add("@CompanyId", SqlDbType.Int, CompanyId);
         oDm.CommandType = CommandType.StoredProcedure;
         return(oDm.ExecuteDataTable("usp_MonthlyPTaxRegister"));
     }
 }
Esempio n. 30
0
        public static void MonthlyDevelopmentBillUpdate(int BillId, decimal Amount)
        {
            using (DataManager oDm = new DataManager())
            {
                oDm.Add("@pBillId", SqlDbType.Int, BillId);
                oDm.Add("@pAmount", SqlDbType.Decimal, Amount);

                oDm.CommandType = CommandType.StoredProcedure;
                oDm.ExecuteNonQuery("usp_MonthlyDevelopmentFeeUpdate");
            }
        }
Esempio n. 31
0
 public static void AuditTrailLogSave(int UserId, int ActionType, string ActionDesc)
 {
     using (DataManager oDm = new DataManager())
     {
         oDm.CommandType = CommandType.StoredProcedure;
         oDm.Add("@pUserId", SqlDbType.Int, UserId);
         oDm.Add("@pActionType", SqlDbType.Int, ActionType);
         oDm.Add("@pActionDesc", SqlDbType.VarChar, 100, ActionDesc);
         oDm.ExecuteNonQuery("Common_ActivityLog_Save");
     }
 }
Esempio n. 32
0
        public static void MemberActivate(int MemberId, bool IsActive)
        {
            using (DataManager oDm = new DataManager())
            {
                oDm.Add("@pMemberId", SqlDbType.Int, MemberId);
                oDm.Add("@pIsActive", SqlDbType.Bit, IsActive);

                oDm.CommandType = CommandType.StoredProcedure;
                oDm.ExecuteNonQuery("usp_MemberMaster_Activate");
            }
        }
        public void ProductProductUpdate(Guid gPARENT_ID, Guid gCHILD_ID)
        {
            using (var oDm = new DataManager())
            {
                oDm.Add("@MODIFIED_USER_ID", SqlDbType.UniqueIdentifier, Security.USER_ID);
                oDm.Add("@PARENT_ID", SqlDbType.UniqueIdentifier, gPARENT_ID);
                oDm.Add("@CHILD_ID", SqlDbType.UniqueIdentifier, gCHILD_ID);

                oDm.CommandType = CommandType.StoredProcedure;
                oDm.ExecuteNonQuery("stp_Zpro_PRODUCT_PRODUCT_Update");
            }
        }
        public void ProductCategoriesUpdate(ref Guid gID, Guid gPARENT_ID, string sNAME, string sDESCRIPTION,
            Int32 nLIST_ORDER)
        {
            using (var oDm = new DataManager())
            {
                oDm.Add("@ID", SqlDbType.UniqueIdentifier, ParameterDirection.InputOutput, gID);
                oDm.Add("@MODIFIED_USER_ID", SqlDbType.UniqueIdentifier, Security.USER_ID);
                oDm.Add("@PARENT_ID", SqlDbType.UniqueIdentifier, Security.USER_ID);
                oDm.Add("@NAME", SqlDbType.NVarChar, 50, gPARENT_ID);
                oDm.Add("@DESCRIPTION", SqlDbType.NText, sDESCRIPTION);
                oDm.Add("@LIST_ORDER", SqlDbType.Int, nLIST_ORDER);

                oDm.CommandType = CommandType.StoredProcedure;
                oDm.ExecuteNonQuery("stp_Zpro_PRODUCT_CATEGORIES_Update");
                gID = CommonTypeConvert.ToGuid(oDm["@ID"].Value);
            }
        }
Esempio n. 35
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (comboBox1.SelectedIndex == -1 || comboBox2.SelectedIndex == -1)
            {
                return;
            }
            insertListView.Columns.Clear();
            deleteListView.Columns.Clear();
            insertListView.Clear();
            deleteListView.Clear();
            updateListView.Columns.Clear();
            updateListView.Clear();
            var metadata = new DataManager().MetaData(this.comboBox1.SelectedItem.ToString(), this.comboBox2.SelectedItem.ToString());
            var redoInsert = "INSERT INTO " + this.comboBox2.SelectedItem.ToString() + "(";
            var undoInsert = "DELETE FROM " + this.comboBox2.SelectedItem.ToString() + " WHERE ";
            for (int i = 0, x = 0; i < metadata.Count - x; i++)
            {
                if (metadata.ElementAt(i).Types == Types.VarChar)
                {
                    var value = metadata.ElementAt(i);
                    metadata.RemoveAt(i);
                    metadata.Add(value);
                    i = -1;
                    x++;
                }
            }

            insertListView.Columns.Add("Transaction ID");
            insertListView.Columns.Add("Begin Time");
            deleteListView.Columns.Add("Transaction ID");
            deleteListView.Columns.Add("Begin Time");
            updateListView.Columns.Add("Transaction ID");
            updateListView.Columns.Add("Begin Time");
            ;            for (var i = 0; i < metadata.Count; i++)
            {

                if (i == metadata.Count - 1)
                {
                    this.deleteListView.Columns.Add(metadata[i].Name);
                    insertListView.Columns.Add(metadata[i].Name);
                    updateListView.Columns.Add(metadata[i].Name);
                    redoInsert += metadata[i].Name + ")";
                }
                else
                {
                    this.deleteListView.Columns.Add(metadata[i].Name);
                    insertListView.Columns.Add(metadata[i].Name);
                    updateListView.Columns.Add(metadata[i].Name);
                    redoInsert += metadata[i].Name + ",";
                }
            }
            this.deleteListView.Columns.Add("Redo SQL");
            this.deleteListView.Columns.Add("Undo SQL");
            insertListView.Columns.Add("Redo SQL");
            insertListView.Columns.Add("Undo SQL");
            updateListView.Columns.Add("Redo SQL");
            updateListView.Columns.Add("Undo SQL");

            redoInsert += " values(";

            AddValues(metadata, "LOP_DELETE_ROWS", undoInsert, redoInsert, metadata);
            AddValues(metadata, "LOP_INSERT_ROWS", redoInsert, undoInsert, metadata);
        }
        public void ProductUpdate(ref Guid gID, Guid gPRODUCT_TEMPLATE_ID, string sNAME, string sSTATUS,
            Guid gACCOUNT_ID, Guid gCONTACT_ID, Int32 nQUANTITY, DateTime dtDATE_PURCHASED,
            DateTime dtDATE_SUPPORT_EXPIRES, DateTime dtDATE_SUPPORT_STARTS, Guid gMANUFACTURER_ID,
            Guid gCATEGORY_ID, Guid gTYPE_ID, string sWEBSITE, string sMFT_PART_NUM,
            string sVENDOR_PART_NUM, string sSERIAL_NUMBER, string sASSET_NUMBER,
            string sTAX_CLASS, float flWEIGHT, Guid gCURRENCY_ID, decimal dCOST_PRICE,
            decimal dLIST_PRICE, decimal dBOOK_VALUE, DateTime dtBOOK_VALUE_DATE,
            decimal dDISCOUNT_PRICE, Int32 nPRICING_FACTOR, string sPRICING_FORMULA,
            string sSUPPORT_NAME, string sSUPPORT_CONTACT, string sSUPPORT_DESCRIPTION,
            string sSUPPORT_TERM, string sDESCRIPTION, Guid gTEAM_ID)
        {
            using (var oDm = new DataManager())
            {
                oDm.Add("@ID", SqlDbType.UniqueIdentifier, ParameterDirection.InputOutput, gID);
                oDm.Add("@MODIFIED_USER_ID", SqlDbType.UniqueIdentifier, Security.USER_ID);
                oDm.Add("@PRODUCT_TEMPLATE_ID", SqlDbType.UniqueIdentifier, gPRODUCT_TEMPLATE_ID);
                oDm.Add("@NAME", SqlDbType.NVarChar, 50, sNAME);
                oDm.Add("@STATUS", SqlDbType.NVarChar, 25, sSTATUS);
                oDm.Add("@ACCOUNT_ID", SqlDbType.UniqueIdentifier, gACCOUNT_ID);
                oDm.Add("@CONTACT_ID", SqlDbType.UniqueIdentifier, gCONTACT_ID);
                oDm.Add("@QUANTITY", SqlDbType.Int, nQUANTITY);
                oDm.Add("@DATE_PURCHASED", SqlDbType.DateTime, dtDATE_PURCHASED);
                oDm.Add("@DATE_SUPPORT_EXPIRES", SqlDbType.DateTime, dtDATE_SUPPORT_EXPIRES); //DATE_COST_PRICE
                oDm.Add("@DATE_SUPPORT_STARTS", SqlDbType.DateTime, dtDATE_SUPPORT_STARTS);
                oDm.Add("@MANUFACTURER_ID", SqlDbType.UniqueIdentifier, gMANUFACTURER_ID);
                oDm.Add("@CATEGORY_ID", SqlDbType.UniqueIdentifier, gCATEGORY_ID);
                oDm.Add("@TYPE_ID", SqlDbType.UniqueIdentifier, gTYPE_ID);
                oDm.Add("@WEBSITE", SqlDbType.NVarChar, 255, sWEBSITE);
                oDm.Add("@MFT_PART_NUM", SqlDbType.NVarChar, 50, sMFT_PART_NUM);
                oDm.Add("@VENDOR_PART_NUM", SqlDbType.NVarChar, 50, sVENDOR_PART_NUM);
                oDm.Add("@SERIAL_NUMBER", SqlDbType.NVarChar, 50, sSERIAL_NUMBER);
                oDm.Add("@ASSET_NUMBER", SqlDbType.NVarChar, 50, sASSET_NUMBER);
                oDm.Add("TAX_CLASS", SqlDbType.NVarChar, 25, sTAX_CLASS);
                oDm.Add("@WEIGHT", SqlDbType.Float, 53, flWEIGHT);
                oDm.Add("@CURRENCY_ID", SqlDbType.UniqueIdentifier, gCURRENCY_ID);
                oDm.Add("@COST_PRICE", SqlDbType.Decimal, dCOST_PRICE); //--
                oDm.Add("@LIST_PRICE", SqlDbType.Decimal, dLIST_PRICE);
                oDm.Add("@BOOK_VALUE", SqlDbType.Money, dBOOK_VALUE);
                oDm.Add("@BOOK_VALUE_DATE", SqlDbType.DateTime, dtBOOK_VALUE_DATE);
                oDm.Add("@DISCOUNT_PRICE", SqlDbType.Decimal, dDISCOUNT_PRICE);
                oDm.Add("@PRICING_FACTOR", SqlDbType.Int, nPRICING_FACTOR);
                oDm.Add("@PRICING_FORMULA", SqlDbType.NVarChar, 25, sPRICING_FORMULA);
                oDm.Add("@SUPPORT_NAME", SqlDbType.NVarChar, 50, sSUPPORT_NAME);
                oDm.Add("@SUPPORT_CONTACT", SqlDbType.NVarChar, 50, sSUPPORT_CONTACT);
                oDm.Add("@SUPPORT_DESCRIPTION", SqlDbType.NVarChar, 255, sSUPPORT_DESCRIPTION);
                oDm.Add("@SUPPORT_TERM", SqlDbType.NVarChar, 25, sSUPPORT_TERM);
                oDm.Add("@DESCRIPTION", SqlDbType.Text, sDESCRIPTION);
                oDm.Add("@TeamID", SqlDbType.UniqueIdentifier, gTEAM_ID);

                oDm.CommandType = CommandType.StoredProcedure;
                oDm.ExecuteNonQuery("stp_Zpro_PRODUCTS_Update");
                gID = CommonTypeConvert.ToGuid(oDm["@ID"].Value);
            }
        }