Example #1
0
        protected void performMove(String CID)
        {
            SqlConnection LAconn = new SqlConnection();
            var           conn   = ConfigurationManager.ConnectionStrings["ConnStringDeltoneCRM"].ConnectionString;

            LAconn.ConnectionString = conn;
            var comDal  = new CompanyDAL(conn);
            var OwnerId = comDal.CheckCompanyOwnerByID(CID);

            if (!string.IsNullOrEmpty(OwnerId))
            {
                String     strSQLInsertStmt = "UPDATE dbo.Companies SET OwnershipAdminID = @OwnershipAdminID, OwnershipPeriod = NULL WHERE CompanyID =@CompanyID";
                SqlCommand LAcmd            = new SqlCommand(strSQLInsertStmt, LAconn);
                LAcmd.Parameters.AddWithValue("@OwnershipAdminID", OwnerId);
                LAcmd.Parameters.AddWithValue("@CompanyID", CID);
                try
                {
                    LAconn.Open();
                    LAcmd.ExecuteNonQuery();
                    LAconn.Close();
                }
                catch (Exception ex)
                {
                    Console.Write(ex.Message.ToString());
                }
            }
        }
Example #2
0
        protected void SaveButton_Click(object sender, EventArgs e)
        {
            var hourAcco = "7";

            if (Session["sorList"] != null)
            {
                var comList = Session["sorList"] as List <CompanyView>;
                foreach (var item in comList)
                {
                    var comdal   = new CompanyDAL(CONNSTRING);
                    var resComId = comdal.CheckCompanyOwnerByID(item.CompanyID);
                    if (string.IsNullOrEmpty(resComId))
                    {
                        comdal.CreateOwnerCompanyId(item.CompanyID, item.OwnershipAdminID.ToString());
                    }
                    PerformMove(item.CompanyID, hourAcco);
                }
            }
        }