Exemplo n.º 1
0
    public string SaveMaster(string pk, string userPk, string title)
    {
        DefinedFormManager dfm = new DefinedFormManager();
        int iPk, iUserPk;

        int.TryParse(pk, out iPk);
        int.TryParse(userPk, out iUserPk);

        var data = new DefinedFormData
        {
            PK           = iPk,
            CompanyId    = 0,
            CreateDate   = DateTime.Now,
            UserModulePK = iUserPk,
            Title        = title
        };

        if (pk == "0")
        {
            pk = dfm.Insert(data);
        }
        else
        {
            dfm.Update(data);
        }

        return(pk);
    }
Exemplo n.º 2
0
    private DefinedFormData GetDefindedForm(SqlDataReader dr)
    {
        DefinedFormData data = new DefinedFormData();

        data.PK           = ((int)(dr["PK"]));
        data.CompanyId    = ((int)(dr["CompanyId"]));
        data.UserModulePK = ((int)(dr["UserModulePK"]));
        data.CreateDate   = ((DateTime)(dr["CreateDate"]));
        data.Title        = dr["Title"].ToString();
        return(data);
    }
Exemplo n.º 3
0
    public virtual void Update(DefinedFormData data)
    {
        string     sqlStr;
        SqlCommand cmd;

        sqlStr = "Update DefinedForm Set CompanyId= @CompanyId,UserModulePK= @UserModulePK,CreateD" +
                 "ate= @CreateDate, Title=@Title Where PK =@PK";
        cmd = new SqlCommand(sqlStr, this.mCon);
        cmd.Parameters.AddWithValue("@CompanyId", data.CompanyId);
        cmd.Parameters.AddWithValue("@UserModulePK", data.UserModulePK);
        cmd.Parameters.AddWithValue("@CreateDate", data.CreateDate);
        cmd.Parameters.AddWithValue("@Title", data.Title);
        cmd.Parameters.AddWithValue("@PK", data.PK);
        this.mCon.Open();
        cmd.ExecuteNonQuery();
        this.mCon.Close();
        cmd.Dispose();
    }
Exemplo n.º 4
0
    public string Insert(DefinedFormData data)
    {
        string     sqlStr;
        SqlCommand cmd;

        sqlStr = "Insert Into DefinedForm(CompanyId,UserModulePK,CreateDate,Title) Values(@Compan" +
                 "yId,@UserModulePK,@CreateDate, @Title) SET @QPk = SCOPE_IDENTITY()";
        cmd = new SqlCommand(sqlStr, this.mCon);
        cmd.Parameters.AddWithValue("@CompanyId", data.CompanyId);
        cmd.Parameters.AddWithValue("@UserModulePK", data.UserModulePK);
        cmd.Parameters.AddWithValue("@CreateDate", data.CreateDate);
        cmd.Parameters.AddWithValue("@Title", data.Title);

        var para = new SqlParameter("@QPk", SqlDbType.Int);

        para.Direction = ParameterDirection.Output;
        cmd.Parameters.Add(para);

        this.mCon.Open();
        cmd.ExecuteNonQuery();
        this.mCon.Close();
        cmd.Dispose();
        return(para.Value.ToString());
    }